package com.example.teesystem.mapper;

import com.example.teesystem.entity.Violation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 12510
* @description 针对表【t_violation】的数据库操作Mapper
* @createDate 2022-04-12 14:57:00
* @Entity com.example.teesystem.entity.Violation
*/
@Mapper
public interface ViolationMapper extends BaseMapper<Violation> {
    @Update("update t_violation set num = num+1 where id=#{id}")
    void addNum(int id);

    @Select("select id from t_violation where student_id = #{studentId} and paper_id = #{paperId}")
    int getId(int studentId,int paperId);

    @Select("select * from t_violation where student_id = #{studentId}")
    List<Violation> getViolationByStudentId(int studentId);
}




